<div class="panel-body">
    <div class="table-responsive">
        <div class="dataTables_wrapper form-inline" id="dataTables-example_wrapper" role="grid">
            <div class="row" style="padding-bottom: 15px">
                <div class="col-sm-6">
                    <!--<div class="dataTables_length" id="dataTables-example_length">-->
                    <!--<select name="dataTables-example_length" class="form-control input-sm"-->
                    <!--aria-controls="dataTables-example">-->
                    <!--<option value="">区/县</option>-->
                    <!--<option value="10">10</option>-->
                    <!--<option value="25">25</option>-->
                    <!--<option value="50">50</option>-->
                    <!--<option value="100">100</option>-->
                    <!--</select>-->
                    <!--<select name="dataTables-example_length" class="form-control input-sm"-->
                    <!--aria-controls="dataTables-example">-->
                    <!--<option value="">分局</option>-->
                    <!--<option value="10">10</option>-->
                    <!--<option value="25">25</option>-->
                    <!--<option value="50">50</option>-->
                    <!--<option value="100">100</option>-->
                    <!--</select>-->
                    <!--<select name="dataTables-example_length" class="form-control input-sm"-->
                    <!--aria-controls="dataTables-example">-->
                    <!--<option value="">网格</option>-->
                    <!--<option value="10">10</option>-->
                    <!--<option value="25">25</option>-->
                    <!--<option value="50">50</option>-->
                    <!--<option value="100">100</option>-->
                    <!--</select>-->
                    <!--<select name="dataTables-example_length" class="form-control input-sm"-->
                    <!--aria-controls="dataTables-example">-->
                    <!--<option value="">场景</option>-->
                    <!--<option value="10">10</option>-->
                    <!--<option value="25">25</option>-->
                    <!--<option value="50">50</option>-->
                    <!--<option value="100">100</option>-->
                    <!--</select>-->
                    <!--<a class="btn btn-serch"> <i class="fa fa-search"></i>  查  询</a>-->
                    <!--</div>-->
                </div>
                <div class="col-sm-6">
                    <div class="dataTables_filter" id="dataTables-example_filter" style="float: right">
                        <a class="btn btn-serch" onclick="Addrulestatic()">新增</a>
                    </div>
                </div>
            </div>
            <table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example"
                   aria-describedby="dataTables-example_info">
                <thead>
                <tr role="row">
                    <th tabindex="0" class="sorting_asc" aria-controls="dataTables-example"
                        style="text-align: center;width: 5%;"
                        rowspan="1" colspan="1">序号
                    </th>
                    <th tabindex="0" class="sorting" aria-controls="dataTables-example"
                        style="text-align: center;width: 40%;" rowspan="1"
                        colspan="1">规则名称
                    </th>
                    <th tabindex="0" class="sorting" aria-controls="dataTables-example"
                        style="text-align: center;width: 45%;" rowspan="1"
                        colspan="1">分组名称
                    </th>
                    <th tabindex="0" class="sorting" aria-controls="dataTables-example"
                        style="text-align: center;width: 10%;" rowspan="1"
                        colspan="1">操作
                    </th>
                </tr>
                </thead>
                <tbody id="Chartlist">

                </tbody>
            </table>
            <div class="row">
                    <div id="page" style="float: right"></div>
            </div>
        </div>
    </div>

</div>
<script>
    $(function () {
        //加载数据
        getdata(1);
    });

    ////请求列表
    function getdata(page) {
        var json = {
            "url": GLOBAL.URL + "/chartinfo/list",
            "type": 'get',
            "data":{"page":page,"limit":15},
            "successfn": function(data) {
                UpdateChartList(data.page.list);
                setPage(data.page.totalPage);
            },
            "errorfn": function() {
                //ajaxUpdataTable();
                //$.ligerDialog.warn("系统繁忙，请稍候再试");
            }
        };
        ajaxdata(json);

    }
    ////加载列表数据
    function UpdateChartList(data) {
        var listStr="";
        if(data != null) {
            for(var i = 0; i < data.length; i++) {
                data[i].title=data[i].title==null?"":data[i].title;
                data[i].groupName=data[i].groupName==null?"":data[i].groupName;
                if((i+1) % 2 > 0) {
                    listStr += '<tr  class="gradeA odd">';
                    listStr += '<td style="text-align: center;">' + (i+1) + '</td>';
                    listStr += '<td style="text-align: center;">'+data[i].title+'</td>';
                    listStr += '<td style="text-align: center;">'+data[i].groupName+'</td>';//<a onclick="Editrulestatic(' + data[i].id + ')">编辑</a>
                    listStr +='<td  style="text-align:center;"> <a onclick="Delrulestatic(' + data[i].id + ')">删除</a></td>';
                    listStr += '</tr>';
                }
                else {
                    listStr += '<tr class="gradeA even">';
                    listStr += '<td style="text-align: center;">' + (i+1) + '</td>';
                    listStr += '<td style="text-align: center;">'+data[i].title+'</td>';
                    listStr += '<td style="text-align: center;">'+data[i].groupName+'</td>';//<a onclick="Editrulestatic(' + data[i].id + ')">编辑</a> 
                    listStr +='<td  style="text-align:center;"><a onclick="Delrulestatic(' + data[i].id + ')">删除</a></td>';
                    listStr += '</tr>';
                }
            }
        }
        $("#Chartlist").html(listStr);
    }
    //新增规则
    function Addrulestatic() {
        GLOBAL.LOADURl = "Page/system/rulestatic/index.html";
        $("#tabC").load("Page/system/rulestatic/addrulestatic.html");
    }
    //编辑规则
    function Editrulestatic(ID) {
        GLOBAL.LOADURl = "Page/system/department/index.html";
        $("#tabC").load("Page/system/rulestatic/eidtrulestatic.html");
    }
    //删除规则
    var deleterulestatic=function (ID,dblChoseAlert) {
        $.ajax({
            type: 'get', //请求的类型
            url: GLOBAL.URL + "/chartinfo/delete?ids=" + ID, //请求的地址
            dataType: "json", //返会值的类型
            async: false,
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true,
            success: function(datas, textStatus) { //请求成功执行的代码
                if(datas.code == 0) {
                    var onlyChoseAlert = simpleAlert({
                        "content": "删除成功！",
                        "buttons": {
                            "确定": function() {
                                getdata(1);
                                dblChoseAlert.close();
                                onlyChoseAlert.close();
                            }
                        }
                    });
                } else if (datas.code == "403") {
                    AlertInfo("操作失败！" + datas.msg);
                    window.location.href = "login.html";
                }  else {
                    AlertInfo("请求失败！" + datas.msg);
                }
            },
            error: function() {
                json.errorfn();
            }

        });
    }

    function Delrulestatic(ID) {
        AlertDel(deleterulestatic,ID);
    }
</script>